#ifndef _FXMATH_ZIP_
#define _FXMATH_ZIP_

//*****************************************************************************
//* Reader for ZIP package
//*****************************************************************************
FX_DEFINEHANDLE(FX_HZIPFILE)

class IFX_ZIPReader
{
public:
	virtual void			Release() = 0;

	virtual FX_POSITION		GetFirstPos() const = 0;
	virtual FX_HZIPFILE		GetNext(FX_POSITION &pos) const = 0;
	virtual FX_HZIPFILE		FindFile(FX_BSTR bsPathName) const = 0;

	virtual FX_INT32		CountFiles() const = 0;

	virtual FX_BOOL			GetFilePathName(FX_HZIPFILE hFile, CFX_ByteString &bsPathName, FX_BOOL *bUtf8Encode = NULL) = 0;
	virtual FX_INT32		GetFileSize(FX_HZIPFILE hFile, FX_BOOL bUncompressed = TRUE) = 0;
	virtual FX_BOOL			GetLastModifiedTime(FX_HZIPFILE hFile, FX_SYSTEMTIME& modTime) = 0;

	virtual IFX_BufferRead*	OpenFile(FX_HZIPFILE hFile, FX_BOOL bRawData = FALSE) = 0;
};

IFX_ZIPReader*	FX_ZIPReader_Create(IFX_FileRead *pFile);
IFX_BufferRead*	FX_ZIPReader_Decompress(IFX_FileRead *pSrcFile, FX_INT32 iUnCompressLen, FX_BOOL bReleaseFile);

//*****************************************************************************
//* Writer for ZIP package
//*****************************************************************************
class IFX_ZIPWriter
{
public:
	virtual void			Release() = 0;

	virtual FX_BOOL			StartZIP() = 0;
	virtual void			EnableAdlerChecksum(FX_BOOL bEnabled) = 0;
	virtual FX_BOOL			StartFile(FX_BSTR bsPathName, IFX_FileRead *pFile, FX_BOOL bCompress = TRUE, FX_BOOL bUtf8Encode = FALSE, const FX_SYSTEMTIME* modifiedTime = NULL) = 0;
	virtual FX_INT32		CompressFile(IFX_Pause *pPause = NULL) = 0;
	virtual FX_BOOL			StartData(FX_BSTR bsPathName, FX_BOOL bCompress = TRUE, FX_BOOL bUtf8Encode = FALSE, const FX_SYSTEMTIME* modifiedTime = NULL) = 0;
	virtual FX_INT32		CompressData(FX_LPCBYTE pBuffer, FX_INT32* pLength, FX_BOOL bLast) = 0;
	virtual void			EndFile() = 0;
	virtual void			EndZIP() = 0;
};

IFX_ZIPWriter*	FX_ZIPWriter_Create(IFX_FileWrite *pFile);

#endif //_FXMATH_ZIP_
